﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

using Htss.Platform.Data;

namespace DreamBox.DAL.Posts
{
    public class Attention
    {
        /// <summary>
        /// 添加关注
        /// </summary>
        /// <param name="PostsID"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public string Add(int PostsID,int UserID)
        {
            DbProc gProc = new DbProc("dbox_proc_PostsAttentionAdd");
            gProc.SetFields("@UserID",UserID);
            gProc.SetFields("@PostsID",PostsID);
            gProc.SetFields("@returnMsg", "", SqlDbType.NVarChar, 100, ParameterDirection.Output);
            GHashTable hashTbl = gProc.ExecNonQueryHashTable();
            return hashTbl["@returnMsg"].ToString();
        }
        /// <summary>
        /// 删除关注记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public bool Delete(int AttID,int UserID)
        {
            DbProc gProc = new DbProc("dbox_proc_PostsAttentionDel");
            gProc.SetFields("@AttID", AttID);
            gProc.SetFields("@UserID", UserID);
            gProc.SetFields("@returnValue", -1, SqlDbType.Int, 4, ParameterDirection.ReturnValue);
            GHashTable hashTbl = gProc.ExecNonQueryHashTable();
            return int.Parse(hashTbl["@returnValue"].ToString()) > -1 ? true : false;
        }
    }
}
